package com.swarovski.rmi;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

public class TestRmiClientService {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		// Variablen initialisieren
		String host = "192.168.1.39";
		int port = 4711;
		String serviceName = "TestRmiService";
		String value = "Hallo Service";

		try {
			// Sevice erzeugen
			ClientInterface service = (ClientInterface) Naming.lookup("rmi://" + host
					+ ":" + port + "/" + serviceName);

			// Teste Service
			String message = service.echoService(value);

			// Output
			System.out.println(message);

		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (NotBoundException e) {
			e.printStackTrace();
		}

	}
}
